/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author TimoR
 */
@Entity
@Table(name = "threads")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Threads.findAll", query = "SELECT t FROM Threads t"),
    @NamedQuery(name = "Threads.findById", query = "SELECT t FROM Threads t WHERE t.id = :id"),
    @NamedQuery(name = "Threads.findByFid", query = "SELECT t FROM Threads t WHERE t.fid = :fid"),
    @NamedQuery(name = "Threads.findByAnamount", query = "SELECT t FROM Threads t WHERE t.anamount = :anamount"),
    @NamedQuery(name = "Threads.findByCalls", query = "SELECT t FROM Threads t WHERE t.calls = :calls"),
    @NamedQuery(name = "Threads.findByAuthor", query = "SELECT t FROM Threads t WHERE t.author = :author"),
    @NamedQuery(name = "Threads.findByLastn", query = "SELECT t FROM Threads t WHERE t.lastn = :lastn"),
    @NamedQuery(name = "Threads.findByLastd", query = "SELECT t FROM Threads t WHERE t.lastd = :lastd"),
    @NamedQuery(name = "Threads.findByCreated", query = "SELECT t FROM Threads t WHERE t.created = :created")})
public class Threads implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "fid")
    private Integer fid;
    @Lob
    @Size(max = 65535)
    @Column(name = "topic")
    private String topic;
    @Basic(optional = false)
    @NotNull
    @Column(name = "anamount")
    private int anamount;
    @Basic(optional = false)
    @NotNull
    @Column(name = "calls")
    private int calls;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "author")
    private String author;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "lastn")
    private String lastn;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 22)
    @Column(name = "lastd")
    private String lastd;
    @Basic(optional = false)
    @NotNull
    @Column(name = "created")
    @Temporal(TemporalType.TIMESTAMP)
    private Date created;

    public Threads() {
    }

    public Threads(Integer id) {
        this.id = id;
    }

    public Threads(Integer id, int anamount, int calls, String author, String lastn, String lastd, Date created) {
        this.id = id;
        this.anamount = anamount;
        this.calls = calls;
        this.author = author;
        this.lastn = lastn;
        this.lastd = lastd;
        this.created = created;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getFid() {
        return fid;
    }

    public void setFid(Integer fid) {
        this.fid = fid;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public int getAnamount() {
        return anamount;
    }

    public void setAnamount(int anamount) {
        this.anamount = anamount;
    }

    public int getCalls() {
        return calls;
    }

    public void setCalls(int calls) {
        this.calls = calls;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getLastn() {
        return lastn;
    }

    public void setLastn(String lastn) {
        this.lastn = lastn;
    }

    public String getLastd() {
        return lastd;
    }

    public void setLastd(String lastd) {
        this.lastd = lastd;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Threads)) {
            return false;
        }
        Threads other = (Threads) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Threads[ id=" + id + " ]";
    }
    
}
